//
//  DYMSDingzuoBottom.swift
//  SheYangBigData
//
//  Created by 叁拾叁 on 2021/2/5.
//  Copyright © 2021 叁拾叁. All rights reserved.
//



import UIKit
import YYText

class DYMSDingzuoBottom: SYBaseView {
    
    
    var bgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = .white
        v.layer.shadowColor = UIColor(hex: 0xB3B3B3).cgColor
        v.layer.shadowOpacity = 0.5//阴影透明度
        v.layer.shadowOffset = CGSize(width: 0, height: -5)///阴影偏移量,四周
        v.layer.shadowRadius = 5//阴影半径  shadowPathWidth：阴影宽度
        return v
    }()
    
    let fir: UILabel = {
        let v = UILabel()
        
        v.font = 13.autoFontSize()
        v.textColor = UIColor.white
//        v.isUserInteractionEnabled = true
        return v
    }()
    
    let sec: UILabel = {
        let v = UILabel()
        v.text = "立即订座"
        v.font = 18.autoFontSize()
        v.textColor = UIColor.white
//        v.isUserInteractionEnabled = true
        return v
    }()
    
    var sepView: UIView = {
        let v = UIView()
        v.backgroundColor = UIColor.white
        return v
    }()
   

    let tijiao: UIButton = {
        let v: UIButton  = UIButton(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH - 30.autoWidth(), height: 44.autoWidth()))
        v.vg_gradLayerCreat(leftC: UIColor(hex: 0xFF7F00), rightC: UIColor(hex: 0xFF9700))
        v.layer.cornerRadius = 18.autoWidth()
        v.layer.masksToBounds = true
        return v
    }()
    
    func configure(_ tip: String) {
        fir.text = tip
    }
    
    override func initViews() {
        
        
        tijiao.addAction {[weak self] in
            if let `self` = self {
                self.clickedClosure?(0)
            }
        }
        
        addSubview(bgView)
        addSubview(tijiao)
        
        addSubview(fir)
        addSubview(sec)
        addSubview(sepView)
        bgView.snp.makeConstraints { (make) in
            make.top.left.right.bottom.equalToSuperview()
        }
        
        tijiao.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(15.autoWidth())
            make.right.equalToSuperview().offset(-15.autoWidth())
            make.height.equalTo(36.autoWidth())
        }
        fir.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(34.autoWidth())
            make.height.equalTo(36.autoWidth())
        }
        sec.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-45.autoWidth())
            make.height.equalTo(36.autoWidth())
        }
        sepView.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-133.autoWidth())
            make.height.equalTo(23.autoWidth())
            make.width.equalTo(2.autoWidth())
        }
    }
}



class DYMSDingzuorenBottom: SYBaseView {
    
    let alert = RYPaySuccessAlert()
    
    var bgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = .white
        v.layer.shadowColor = UIColor(hex: 0xB3B3B3).cgColor
        v.layer.shadowOpacity = 0.5//阴影透明度
        v.layer.shadowOffset = CGSize(width: 0, height: -5)///阴影偏移量,四周
        v.layer.shadowRadius = 5//阴影半径  shadowPathWidth：阴影宽度
        return v
    }()
    
    let sec: UILabel = {
        let v = UILabel()
        v.text = "立即订座"
        v.font = 18.autoFontSize()
        v.textColor = UIColor.white
//        v.isUserInteractionEnabled = true
        v.textAlignment = .center
        return v
    }()
   

    let tijiao: UIButton = {
        let v: UIButton  = UIButton(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH - 30.autoWidth(), height: 36.autoWidth()))
        v.vg_gradLayerCreat(leftC: UIColor(hex: 0xFF7F00), rightC: UIColor(hex: 0xFF9700))
        v.layer.cornerRadius = 18.autoWidth()
        v.layer.masksToBounds = true
        return v
    }()

    
    override func initViews() {
        
        
        tijiao.addAction {[weak self] in
            if let `self` = self {
                self.clickedClosure?(0)
            }
        }
        
        addSubview(bgView)
        addSubview(tijiao)
        addSubview(sec)
        bgView.snp.makeConstraints { (make) in
            make.top.left.right.bottom.equalToSuperview()
        }
        
        tijiao.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(6.5.autoWidth())
            make.left.equalToSuperview().offset(15.autoWidth())
            make.right.equalToSuperview().offset(-15.autoWidth())
            make.height.equalTo(36.autoWidth())
        }
        
        sec.snp.makeConstraints { (make) in
            make.center.equalTo(tijiao)
            make.height.equalTo(36.autoWidth())
        }
    }

    func setAlert() {
        
        let window = UIApplication.shared.keyWindow
        window?.addSubview(alert)
        alert.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }
    }
}
